<template>
  <div>
    <van-nav-bar :title="$route.name" @click-left="$router.back()" left-text="返回" left-arrow/>
    <!-- 商品列表 -->
    <van-card
      @click="goDetail(item.id)"
      v-for="item in goodslist"
      :key="item.id"
      num="1"
      :price="item.price | toPrice"
      desc="描述信息"
      :title="item.goodsname"
      :thumb="item.img"
      :origin-price="item.market_price | toPrice"
    />
  </div>
</template>

<script>
import {goodsList} from '../request/api'
export default {
  data() {
    return {
        goodslist:[],
    };
  },
  mounted(){
      goodsList({
          cateid:this.$route.query.id,
      }).then((res)=>{
          console.log(res,'商品列表');
          if(res.code==200){
              this.goodslist = res.list.goodData;
          }
      });
  },
  methods:{
      //跳转详情接口
      goDetail(id){
          this.$router.push({
              path:"/detail",
              query:{
                  id,
              }
          })
      }
  }
};
</script>

<style scoped>
</style>
